

package enums


var enumSQL = map[string]string{
	"system_info":"select id value,name name,'system_info' type from sso_system_info",
	"user_info":"select user_id value,full_name name,mobile 电话号码,'user_info' type from sso_user_info",
	"role_info":"select role_id value,name name,'role_info' type from sso_role_info",
}

var unspecifiedEnum = []string{
	"select value value,name name,type type from dds_dictionary_info where type=if(@type='',type,@type)",
	"select canton_code value,chinese_name name,parent_code type from dds_area_info where parent_code=if(@type='',parent_code,@type)",
}
var sqls = make([]string, 0, 1)

func getSQLs(tp string) []string {
	//返回所有枚举
	if tp == "" || tp == "*" {
		return sqls
	}

	//根据枚举查询具体提供SQL
	vsqls, ok := enumSQL[tp]
	if ok {
		return []string{vsqls}
	}

	//指定未明确类型的枚举
	return unspecifiedEnum
}
func init() {
	for _, v := range enumSQL {
		sqls = append(sqls, v)
	}
	sqls = append(sqls, unspecifiedEnum...)
}
